<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>函数求阶乘</title>
	</head>
	<body>
		
	</body>
	<script>
		function getJC(n){
			var num =1;
			for(var i=2;i<=n;i++){
				num *= i;
			}
			return num;
		}
		function getSum(n){
			var sum = 0;
			for(var i = 1;i<=n;i++){
				sum +=getJC(i); 
			}
			return sum;
		}
		
		document.write('3的阶乘是：'+ getJC(3)+'<br>');
		document.write('3的阶乘和是：'+ getSum(3));
	</script>
</html>
